<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>
<body>
  <script>
    /* 
      https://leetcode-cn.com/problems/reverse-linked-list/
      思路：https://leetcode-cn.com/problems/reverse-linked-list/solution/shi-pin-jiang-jie-di-gui-by-geek-8m/
    */
    var reverseList = function (head) {
      let p1 = head
      let p2 = null

      while (p1) {
        let temp = p1.next
        p1.next = p2
        p2 = p1
        p1 = temp
      }
      return p2
    };
  </script>
</body>
</html>